<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="mvc" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.divForm{
position: absolute;
border: 1px solid red;
text-align: center;
top: 50%;
left: 50%;
margin-top: -200px;
margin-left: -150px;
border-width: 0px;
}
</style>
<meta charset="UTF-8">
<title>新增用户</title>
</head>
<script type="text/javascript" src="${ctx}/static/js/jquery.min.js"></script>
<script type="text/javascript">
	$(function() {

		$("input[type='submit']").click(function(){
			if($("input[name='username']").val()==""){
				alert("用户名不能为空！");
				return false;
			}
			if($("input[name='password']").val()==""){
				alert("密码不能为空！");
				return false;
			}
			if($("input[name='age']").val()==""){
				alert("年龄不能为空！");
				return false;
			}
			
		})

	}
	);

</script>
<body>
	<div class="divForm">
	<form action="${ctx}/add" method="POST" >
		用户名：<input type="text" name="username" placeholder="请输入用户名"/><br/>
		密&emsp;码：<input type="text" name="password" placeholder="请输入密码"/><br/>
		年&emsp;龄：<input type="text" name="age" placeholder="请输入年龄"/><br/>
		<input type="submit" value="提交" /><div id="info"></div>
	</form>
	</div>

</body>
</html>